package com.sr.wslr.common.util;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by 17032906 on 2017/10/20.
 */
public class AjaxUtil {
    /**
     * 是否是Ajax请求
     *
     * @param request
     * @return
     */
    public static boolean isAjaxRequest(HttpServletRequest request) {
        String requestedWith = request.getHeader("x-requested-with");
        if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
            return true;
        } else {
            return false;
        }
    }
}
